#ifndef PIBOT_SIMPLE_DATAFRAME_MASTER_H_
#define PIBOT_SIMPLE_DATAFRAME_MASTER_H_

#include "simple_dataframe.h"
#include <string.h>
#include "data_holder.h"
#include <stdio.h>
#include "tcptalk.h"
#include "timer_ros.h"

//#include <boost/thread.hpp>
//#include <boost/thread/lock_factories.hpp>

class Simple_dataframe : public Dataframe{
    public:
        Simple_dataframe();
        static Simple_dataframe* FrameInstance;
        static rclcpp::Node::SharedPtr node;
		static void set_static_node(rclcpp::Node::SharedPtr n)
		{
			node = n;
		}
		
		static Simple_dataframe* Frame_Instance()
		{
			if(FrameInstance == NULL)
				FrameInstance = new Simple_dataframe();
			
			return FrameInstance;
		}
        ~Simple_dataframe();
        void register_notify(const MESSAGE_ID id, Notify* _nf){
        }

        bool data_recv(unsigned char c);
        bool data_parse();
        bool init();
        bool interact(const MESSAGE_ID id,const unsigned char* data,const char len);
        bool recv_proc();
    private:
        bool send_message(const MESSAGE_ID id);
        bool send_message(const MESSAGE_ID id, const unsigned char* data, const unsigned char len);
        bool send_message(Message* msg);

    private:
        Message active_rx_msg;

        RECEIVE_STATE recv_state;

};
#endif
